﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TreeSharp;
using Styx.Combat.CombatRoutine;
using Styx;
using FelMaster.Classes;

namespace FelMaster
{
    public class Frost : TalentBase
    {
        public override string Name
        {
            get { return "Frost by ossirian"; }
        }

        public override float CombatMaxDistance
        {
            get
            {
                return 5f;
            }
        }

        public override Composite Buffs
        {
            get
            {
                return new PrioritySelector(
                    SC.CastSpell("Horn of Winter", a => true, "Horn of Winter")
                );
            }
        }

        public override string KeySpell
        {
            get { return "Frost Strike"; }
        }

        public override Composite SingleRotation
        {
            get
            {
                return new PrioritySelector(
                    SC.CastBuff("Unholy Presence", a => true, "Unholy Presence"),
                    SC.CastBuff("Horn of Winter", a => true, "Horn of Winter"),
                    SC.CastBuff("Pillar of Frost", a => SC.TargetHasDebuff("Blood Plague") && SC.TargetHasDebuff("Frost Fever") && Me.CurrentTarget.CurrentHealth > 1500000 || Me.CurrentTarget.MaxHealth == 1, "Pillar of Frost"),
                    SC.CastSpell("Blood Tap", a => true, "Blood Tap"),
                    SC.CastBuff("Raise Dead", a => SC.PlayerHasBuff("Pillar of Frost") && SC.TargetHasDebuff("Blood Plague") && SC.TargetHasDebuff("Frost Fever") && Me.CurrentTarget.CurrentHealth > 1500000 || Me.CurrentTarget.MaxHealth == 1, "Raise Dead"),
                    SC.CastSpell("Mind Freeze", a => Me.GotTarget && Me.CurrentTarget.IsCasting, "Mind Freeze"),
                    SC.CastSpell("Outbreak", a => !SC.TargetHasDebuff("Blood Plague"), "Outbreak"),
                    SC.CastSpell("Plague Strike", a => !SC.TargetHasDebuff("Blood Plague"), "Plague Strike"),
                    SC.CastSpell("Howling Blast", a => !SC.TargetHasDebuff("Frost Fever"), "Howling Blast"),
                    SC.CastSpell("Howling Blast", a => SC.CountEnnemiesInRange(Me.Location, 16) > 2, "Howling Blast"),
                    SC.CastSpell("Obliterate", a => SC.PlayerHasBuff("Killing Machine"), "Obliterate"),
                    SC.CastSpell("Howling Blast", a => SC.PlayerHasBuff("Freezing Fog"), "Howling Blast"),
                    SC.CastSpell("Obliterate", a => true, "Obliterate"),
                    SC.CastSpell("Frost Strike", a => true, "Frost Strike"),
                    SC.CastSpell("Empower Rune Weapon", a => true, "Empower Rune Weapon"),
                    SC.CastSpell("Horn of Winter", a => true, "Horn of Winter")
                );
            }
        }

        public override Composite PVPRotation
        {
            get
            {
                return new PrioritySelector(
                    SC.CastBuff("Unholy Presence", a => true, "Unholy Presence"),
                    SC.CastBuff("Horn of Winter", a => true, "Horn of Winter"),
                    SC.CastSpell("Blood Tap", a => true, "Blood Tap"),
                    SC.CastBuff("Raise Dead", a => SC.PlayerHasBuff("Pillar of Frost") && SC.TargetHasDebuff("Frost Fever"), "Raise Dead"),
                    SC.CastSpell("Mind Freeze", a => Me.GotTarget && Me.CurrentTarget.IsCasting, "Mind Freeze"),
                    SC.CastSpell("Strangulate", a => Me.CurrentTarget.HealthPercent < 40 && Me.GotTarget && Me.CurrentTarget.IsCasting, "Strangulate"),
                    SC.CastSpell("Chains of Ice", a => Me.CurrentTarget.Distance > 10 && !SC.TargetHasDebuff("Chains of Ice"), "Chains of Ice"),
                    SC.CastSpell("Howling Blast", a => true, "Howling Blast"),
                    SC.CastSpell("Necrotic Strike", a => true, "Necrotic Strike"),
                    SC.CastBuff("Pillar of Frost", a => true, "Pillar of Frost"),
                    SC.CastSpell("Howling Blast", a => SC.PlayerHasBuff("Freezing Fog"), "Howling Blast"),
                    SC.CastSpell("Frost Strike", a => true, "Frost Strike"),
                    SC.CastSpell("Empower Rune Weapon", a => true, "Empower Rune Weapon"),
                    SC.CastSpell("Outbreak", a => !SC.TargetHasDebuff("Blood Plague"), "Outbreak"),
                    SC.CastSpell("Horn of Winter", a => true, "Horn of Winter")
                );
            }
        }

        public override Composite PVERotation
        {
            get { return SingleRotation; }
        }
    }
}
